import ExamComponent from "@components/Apps/Exam/ExamComponent";
import ExamSettings from "@components/Apps/Exam/ExamSettings";
import { ClientMessage } from "@runtime/generate/message/ClientMessage";
import DeviceComponent from "@runtime/module/Device/DeviceComponent";
import MessageHandler from "@runtime/module/Handler/MessageHandler";

/**
 * 设备更新消息处理器
 */
export default class DeviceUpdateMessageHandler extends MessageHandler<ClientMessage.DeviceUpdateMessage> {
    protected async RunAsync(message: ClientMessage.DeviceUpdateMessage): Promise<void> {
        DeviceComponent.Default.Update(message.Informations);

        if (message.Informations.length > 0) {
            ExamComponent.Default.DeviceStatus.value = message.Informations[0].Status;
        }
    }
}
